Skip to content

Forms: Add an export-responses ability - #55482

Open
t-wright wants to merge 6 commits into
trunkfrom
claude/jetpack-form-export-abilities-c84595
Open

t-wright wants to merge 6 commits into
trunkfrom
claude/jetpack-form-export-abilities-c84595

Conversation

@t-wright

@t-wright t-wright commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #

Proposed changes

  • Add a jetpack-forms/export-responses ability. It returns a download link for the same CSV file as the Export button, with the same filters and the export capability check.
  • The link works for 15 minutes, only for the user who asked, and only while they can still export.

Why: agents can now give users all their responses as a file, instead of reading them in pages.

Related product discussion/links

  • MCP-1359

Does this pull request change what data or activity we track or use?

No.

Testing instructions

  • Install this branch on a JN site with Jetpack connected
  • Add some form responses to your site
  • Execute remote:jetpack-forms/export-responses through an MCP client like MCP Inspector (send {"form_id": <id>, "include_test_responses": true} to filter to a specific form), or ask your connected agent to export your form responses.
  • Check that the count and forms match, then open the download_url and compare the CSV with the one the Export button makes in the wp-admin.
  • Open the link as another user or signed out, and check that it refuses or asks you to log in.
  • Wait 15 minutes, open the link again, and check that it says the link has expired.
  • Export the form responses through wp-admin as well and check for regressions.

Agents can give users all their form responses as a CSV file, through a 15-minute download link that works only for the user who asked.
@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack), and enable the claude/jetpack-form-export-abilities-c84595 branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack claude/jetpack-form-export-abilities-c84595

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions github-actions Bot added [Feature] Contact Form [Package] Forms [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Tests] Includes Tests labels Nov 26, 2026
@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!


Jetpack plugin:

The Jetpack plugin has different release cadences depending on the platform:

  • WordPress.com Simple releases happen as soon as you deploy your changes after merging this PR (PCYsg-Jjm-p2).
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly:
    • Scheduled release: December 8, 2026
    • Code freeze: December 7, 2026

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@jp-launch-control

jp-launch-control Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Code Coverage Summary

Coverage changed in 2 files.

File Coverage Δ% Δ Uncovered
projects/packages/forms/src/abilities/class-forms-abilities.php 638/690 (92.46%) 1.82% 0 💚
projects/packages/forms/src/contact-form/class-contact-form-plugin.php 857/1673 (51.23%) 3.51% -30 💚

1 file is newly checked for coverage.

File Coverage
projects/packages/forms/src/contact-form/class-response-export-link.php 58/63 (92.06%) 💚

Full summary · PHP report · JS report

Keep the link's record for a day, so a link opened after its 15 minutes says it expired instead of that it doesn't work for the account. Add tests for the download handler and the 50-form cap, tighten the export tests, and run the tests that send headers in separate processes for PHPUnit 9.
The WordPress.com MCP checks reject new negative imperatives in ability text. The link already works only for the user who asked, so the description states that.
The wpcom cross-tool reference check fails when one ability's text names another.
@t-wright
t-wright marked this pull request as ready for review November 27, 2026 04:47
Read export dates in site time, so a date with a timezone no longer shifts by the site's UTC offset. Count responses and list forms in SQL, so the ability does not load every response into memory. Leave flagged test responses out of the count, so a link is not returned for a file with no rows. Send signed-out users through auth_redirect(), so the link survives a login on another host.
The closure always throws, and Phan fails the static analysis check unless a function like that is documented with @return never.
@t-wright
t-wright requested a review from a team November 27, 2026 06:29

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant